$codeBgColor: #282c34;
$codeLang: js ts html md vue css sass scss less stylus go java c sh yaml py docker dockerfile
  makefile php;

.mu-markdown-theme {

  &>h1,
  &>h2{
    &:first-child {
      margin-bottom: 1.5em;
    }
  }

  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    font-weight: 600;
    line-height: 1.25;

    .header-anchor {
      font-size: 0.85em;
      float: left;
      margin-left: -0.87em;
      padding-right: 0.23em;
      margin-top: 0.125em;
      opacity: 0;
      color: #ec2138;
    }

    &:hover {
      .header-anchor {
        opacity: 1;
      }
    }
  }

  h1 {
    font-size: 2em;
    margin: 1em 0;
  }

  h2 {
    font-size: 1.65rem;
    padding-bottom: 0.3rem;
    margin: 0.83em 0;
  }

  h3 {
    font-size: 1.35rem;
    margin: 1em 0;
  }

  h4 {
    margin: 1.33em 0;
  }

  strong {
    font-weight: 600;
  }
  ol,
  p,
  ul {
    line-height: 1.7;
  }

  ol,
  ul {
    list-style: disc;
    padding-left: 1.2em;
  }

  a {
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
  }

  p {
    margin: 1em 0;
  }

  a,
  p a code {
    color: #3eaf7c;
  }

  table {
    border-collapse: collapse;
    margin: 1rem 0;
    display: block;
    overflow-x: auto;
  }

  tr {
    border-top: 1px solid #dfe2e5;
  }

  tr:nth-child(2n) {
    background-color: #f6f8fa;
  }

  td,
  th {
    border: 1px solid #dfe2e5;
    padding: 0.6em 1em;
  }

  code {
    color: #ec2138;
    padding: 0.25rem 0.5rem;
    margin: 0;
    font-size: 0.85em;
    background-color: rgba(27, 31, 35, 0.05);
    border-radius: 3px;
  }

  div[class*='language-'] {
    position: relative;
    background-color: $codeBgColor;
    border-radius: 6px;
    &::before {
      position: absolute;
      z-index: 3;
      top: 0.8em;
      right: 1em;
      font-size: 0.75rem;
      color: hsla(0, 0%, 100%, 0.4);
      content: '';
    }

    pre,
    pre[class*='language-'] {
      background: transparent;
      position: relative;
      z-index: 1;
    }
  }

  code[class*='language-'],
  pre[class*='language-'] {
    color: #ccc;
    background: none;
    font-family: Consolas, Monaco, Andale Mono, Ubuntu Mono, monospace;
    font-size: 1em;
    text-align: left;
    white-space: pre;
    word-spacing: normal;
    word-break: normal;
    word-wrap: normal;
    line-height: 1.4;
    tab-size: 2;
    hyphens: none;
  }

  pre[class*='language-'] {
    padding: 1.25rem 1.5rem;
    margin: 0.85rem 0;
    background-color: $codeBgColor;
    border-radius: 6px;
    overflow: auto;

    code {
      color: #fff;
      padding: 0;
      background-color: transparent;
      border-radius: 0;
      margin: 0;
      font-size: 0.85em;
    }
  }

  @each $lang in $codeLang {
    div[class~='language-#{$lang}']:before {
      content: '#{$lang}';
    }
  }

  div[class~='language-javascript']:before {
    content: 'js';
  }

  div[class~='language-typescript']:before {
    content: 'ts';
  }

  div[class~='language-markup']:before {
    content: 'html';
  }

  div[class~='language-markdown']:before {
    content: 'md';
  }

  div[class~='language-json']:before {
    content: 'json';
  }

  div[class~='language-ruby']:before {
    content: 'rb';
  }

  div[class~='language-python']:before {
    content: 'py';
  }

  div[class~='language-bash']:before {
    content: 'sh';
  }
}
